import request from "../utils/request";
//获取数据
export const getMaterial = () => {
    return request.post('/getMaterial')
}
//详情数据
export const getDetailsMaterial = (data: { _id: string }) => {
    return request.post('/getDetailsMaterial', data)
}
//随机4个数据
export const getRandomDetailsMaterial = () => {
    return request.post('/getRandomDetailsMaterial')
}
//获取所有标题数据
export const getTitleM = () => {
    return request.post('/getTitleM')
}
//获取指定标题里面的数据
export const getTitleMaterial = (data: { title: string }) => {
    return request.post('/getTitleMaterial', data)
}

//获取随机6个分类
export const getAggregateTitle = () => {
    return request.post('/getAggregateTitle')
}
//搜索数据
export const searchMaterial = (data: { name: string }) => {
    return request.post('/searchMaterial', data)
}
//注册(获取验证码)
export const regCode = (data: { mail: string }) => {
    return request.post('/regCode', data)
}
//注册
export const reg = (data: { mail: string, code: string, password: string }) => {
    return request.post('/reg', data)
}
//登录
export const login = (data: { mail: string, password: string }) => {
    return request.post('/login', data)
}
//登录判断
export const userLogin = (data: { _id: string }) => {
    return request.post('/userLogin', data)
}
//点赞
export const Live = (data: { mail: string, id: string }) => {
    return request.post('/Live', data)
}
//初始化喜爱
export const Liveinitialization = (data: { mail: string, id: string }) => {
    return request.post('/Liveinitialization', data)
}
//所有用户喜爱
export const userLike = (data: { mail: string }) => {
    return request.post('/userLike', data)
}

//收藏
export const collect = (data: { mail: string, id: string }) => {
    return request.post('/collect', data)
}
//初始化收藏
export const collectinitialization = (data: { mail: string, id: string }) => {
    return request.post('/collectinitialization', data)
}
//所有用户收藏
export const userCollect = (data: { mail: string }) => {
    return request.post('/userCollect', data)
}

//用户喜爱数据
export const userLikeData = (data: { mail: string }) => {
    return request.post('/userLikeData', data)
}

//用户收藏数据
export const userCollectData = (data: { mail: string }) => {
    return request.post('/userCollectData', data)
}

//获取公告
export const getAnn = () => {
    return request.post('/getAnn')
}

//下载
export const download = (data: { id: string, mail: string }) => {
    return request.post('/download',data, {
        responseType: 'blob'
    })
}

//获取购买getDataMaterial
export const getBuy = () => {
    return request.post('/getBuy')
}
//创建购买
export const ailpay = (data:{money:string,data:string}) => {
    return request.post('/ailpay',data)
}
//创建购买手机
export const ailpayM = (data:{money:string,data:string}) => {
    return request.post('/ailpayM',data)
}
//获取最新10条素材
export const getDataMaterial = () => {
    return request.post('/getDataMaterial')
}
//获取最新10条素材
export const selectPCGetMaterial = () => {
    return request.post('/selectPCGetMaterial')
}
//获取订单数据
export const getAlipaySdk = (data:{mail:string}) => {
    return request.post('/getAlipaySdk',data)
}